package com.chenyongjing.design.pattern.observer.blog;

import java.util.Observable;
import java.util.Observer;

/**
 * @Author chen
 * @Date 2022/12/5 21:29
 */
public class User implements Observer {

    private String name;

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object message) {
        Blog blog = (Blog) o;
        Message msg = (Message) message;
        System.out.println("===================");
        System.out.println(name+"你好！您收到一个来自["+blog.getName()+"]的消息。消息内容："+msg.getContent()
                +" 发送者:"+msg.getUserName());

    }
}
